<template>
  <div class="route">
    <div class="bottom">
      <div class="con" :class="num == 0 ? 'cons' : ''" @click="find">
        <div>
          <div class="finda" v-show="num != 0"></div>
          <div class="findb" v-show="num == 0"></div>
        </div>
        发现
      </div>
      <div class="con" :class="num == 1 ? 'cons' : ''" @click="classification">
        <div>
          <div class="updatea" v-show="num != 1"></div>
          <div class="updateb" v-show="num == 1"></div>
        </div>
        更新
      </div>
      <div class="homes" :class="num == 2 ? 'cons' : ''" @click="homePage">
        <div>
          <div class="home" v-show="num != 2"></div>
          <div class="homeb" v-show="num == 2"></div>
        </div>
        <p>首页</p>
      </div>
      <div class="con" :class="num == 3 ? 'cons' : ''" @click="Ranking">
        <div>
          <div class="bookshelfa" v-show="num != 3"></div>
          <div class="bookshelfb" v-show="num == 3"></div>
        </div>
        书架
      </div>
      <div class="con" :class="num == 4 ? 'cons' : ''" @click="my">
        <div>
          <div class="mya" v-show="num != 4"></div>
          <div class="myb" v-show="num == 4"></div>
        </div>
        我的
      </div>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      num: 2,
    };
  },
  methods: {
    homePage() {
      this.num = 2;
      if (this.$route.path != "/homePage") {
        this.$router.push("/homePage");
      }
    },
    classification() {
      this.num = 1;
      if (this.$route.path != "/classification") {
        this.$router.push("/classification");
      }
    },
    find() {
      this.num = 0;
      if (this.$route.path != "/find/image") {
        this.$router.push("/find/image");
      }
    },
    Ranking() {
      this.num = 3;
      if (this.$route.path != "/Ranking") {
        this.$router.push("/Ranking");
      }
    },
    my() {
      this.num = 4;
      if (this.$route.path != "/my") {
        this.$router.push("/my");
      }
    },
  },
};
</script>

<style lang="less">
.route {
  z-index: 1;
  .bottom {
    position: fixed;
    bottom: 0;
    width: 100%;
    height: 60px;
    display: flex;
    justify-content: space-around;
    text-align: center;
    font-size: 14px;
    color: #a2a2a2;
    .homes {
      background-image: url(../assets/home_bg.png);
      font-size: 12px;
      background-size: 100% 100%;
      flex: 1;
      height: 100%;
      position: relative;
      div {
        position: absolute;
        left: 16.5%;
        top: -10%;
        width: 50px;
        height: 50px;
        .home {
          background-image: url(../assets/sprite.tabs.f5a3c@2x.png);
          background-size: 225%;
        }
        .homeb {
          background-image: url(../assets/sprite.tabs.f5a3c@2x.png);
          background-size: 225%;
        }
      }
      p {
        text-align: center;
        margin: 0;
        padding-top: 40%;
      }
    }
    .cons {
      color: #fc7681;
    }
    .con {
      width: 18%;
      height: 100%;
      font-size: 12px;
      padding-top: 2px;
      background-image: url(../assets/home_bg_repeat.png);
      background-size: 100% 100%;
      div {
        width: 32px;
        height: 32px;
        position: relative;
        margin: 2px auto;
        div {
          position: absolute;
          background-image: url(../assets/sprite.tabs.f5a3c@2x.png);
          background-size: 500%;
        }
        .finda {
          background-position: 32% 98%;
        }
        .findb {
          background-position-y: 98%;
        }
        .updatea {
          background-position: 67% 47%;
        }
        .updateb {
          background-position-x: 67%;
        }
        .bookshelfa {
          background-position: 100% 94%;
        }
        .bookshelfb {
          background-position: 100% 47%;
        }
        .mya {
          background-position-x: 100%;
        }
        .myb {
          background-position: 66% 98%;
        }
      }
    }
  }
}
</style>